<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title></title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  <script language = "JavaScript">
var subcat = new Array();
subcat[0] = new Array("2","1","星期一");
subcat[1] = new Array("2","2","星期二");
subcat[2] = new Array("2","3","星期三");
subcat[3] = new Array("2","4","星期四");
subcat[4] = new Array("2","5","星期五");
subcat[5] = new Array("2","6","星期六");
subcat[6] = new Array("2","7","星期日");
subcat[7] = new Array("3","1","1");
subcat[8] = new Array("3","2","2");
subcat[9] = new Array("3","3","3");
subcat[10] = new Array("3","4","4");
subcat[11] = new Array("3","5","5");
subcat[12] = new Array("3","6","6");
subcat[13] = new Array("3","7","7");
subcat[14] = new Array("3","8","8");
subcat[15] = new Array("3","9","9");
subcat[16] = new Array("3","10","10");
subcat[17] = new Array("3","11","11");
subcat[18] = new Array("3","12","12");
subcat[19] = new Array("3","13","13");
subcat[20] = new Array("3","14","14");
subcat[21] = new Array("3","15","15");
subcat[22] = new Array("3","16","16");
subcat[23] = new Array("3","17","17");
subcat[24] = new Array("3","18","18");
subcat[25] = new Array("3","19","19");
subcat[26] = new Array("3","20","20");
subcat[27] = new Array("3","21","21");
subcat[28] = new Array("3","22","22");
subcat[29] = new Array("3","23","23");
subcat[30] = new Array("3","24","24");
subcat[31] = new Array("3","25","25");
subcat[32] = new Array("3","26","26");
subcat[33] = new Array("3","27","27");
subcat[34] = new Array("3","28","28");
var js_count = 35;
function changemaintype(locationid)
{
	document.main.asmt_frequencyDetail.options[0] = new Option("具体日期","");
	document.main.asmt_frequencyDetail.length = 1;
	var locationid = locationid;
	var ii;
	for(ii=0; ii < js_count; ii++)
	{
		if(subcat[ii][0] == locationid)
		{
			document.main.asmt_frequencyDetail.options[document.main.asmt_frequencyDetail.length] =
			new Option(subcat[ii][2],subcat[ii][1]);
		}
	}
}


function outStr(){
 if(document.all.ip1.value>0 && document.all.ip2.value>0 && document.all.ip3.value>0 && document.all.ip4.value>0){
  alert("你输入的IP地址为：" + document.all.ip1.value + "." + document.all.ip2.value + "." + document.all.ip3.value + "." + document.all.ip4.value);
 }//end if
}//end
function moveRight(obj){
 id = parseInt(obj.name.substr(2,1))
 if(id<4){
  eval("document.all.ip" + (id +1) + ".focus()");
 }else{
 }//end if
}
function moveLeft(obj){
 id = parseInt(obj.name.substr(2,1))
 if(id>1){
  eval("document.all.ip" + (id -1) + ".focus()");
 }//end if
}//end if
function Keypress(obj){
 var objInput = obj;
 cod = window.event.keyCode;
 
 if(cod==46 && (obj.value).length>0){//如果按了"."并且有了一个字符，向右移动一次
  window.event.keyCode=0;
  moveRight(obj);
 }else if((obj.value).length==2 && (cod >= 48) && (cod <= 57)){//如果数字键并且够了两位
  if(cod<58){//
   obj.value = obj.value * 10 + cod - 48;
  }//end if
  window.event.keyCode = 0;
  moveRight(obj);
 }else{ //判断输入的是不是数字
  if ( !(((cod >= 48) && (cod <= 57)) || (cod == 13) || (cod == 37) || (cod == 39))){
   window.event.keyCode = 0;
  }//end if
 }//end if
}//end function keydown

function KeypressTime(obj){
 var objInput = obj;
 cod = window.event.keyCode;
 
 if(cod==46 && (obj.value).length>0){//如果按了"."并且有了一个字符，向右移动一次
  window.event.keyCode=0;
  moveRight(obj);
 }else if((obj.value).length==1 && (cod >= 48) && (cod <= 57)){//如果数字键并且够了两位
  if(cod<58){//
   obj.value = obj.value * 10 + cod - 48;
  }//end if
  window.event.keyCode = 0;
  moveRight(obj);
 }else{ //判断输入的是不是数字
  if ( !(((cod >= 48) && (cod <= 57)) || (cod == 13) || (cod == 37) || (cod == 39))){
   window.event.keyCode = 0;
  }//end if
 }//end if
}//end function keydown


function getCaretPos(obj){
 var currentRange=document.selection.createRange();
 var workRange=currentRange.duplicate();
 obj.select();
 var allRange=document.selection.createRange();
 var len=0;
 while(workRange.compareEndPoints("StartToStart",allRange)>0){
  workRange.moveStart("character",-1);
  len++;
 }
 currentRange.select();
 return len;
}//end
function KeyDown(obj){
 cod = window.event.keyCode;
 i = getCaretPos(obj); //光标位置
 n = obj.value.length; //字符长度
 
 if(cod==37 && i==0){//光标左移
  moveLeft(obj);
 }else if(cod==39 && i>=n){
  moveRight(obj);
 }else if(cod==8 && (obj.value=="" || i==0)){
  moveLeft(obj);
 }//end if
}//end
function checkDate(obj,max_num){
 if(obj.value>max_num || obj.value<0){
  window.event.keyCode = 0;
  alert(obj.value + "是无效的项目，只能输入0到" + max_num + "之间的数。");
  obj.value = max_num;
  obj.focus();
  obj.select();
 }//end if
}//end

function checkNull(obj){
if(obj.value.length == 0)
{
    window.event.keyCode = 0;
    alert("输入不能为空");
    obj.value="";
    obj.focus();
    obj.select();
}

}




</script>  
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F8F9FA;
}
-->
</style>

<link href="Jsp/images/skin.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {font-size: 12px}
-->
</style>









  </head>
  
  <body>
   <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="Jsp/images/mail_leftbg.gif"><img src="Jsp/images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="Jsp/images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><span class="STYLE1">当前位置：添加任务</span></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="Jsp/images/mail_rightbg.gif"><img src="Jsp/images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="Jsp/images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
              <tr>
                <td></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="10%" height="55" valign="middle"><img src="Jsp/images/title.gif" width="54" height="55"></td>
                <td width="90%" valign="top"><span class="left_txt2">在这里，您可以根据您的要求，添加新的备份任务</span><span class="left_txt2">！</span><br></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
              <tr>
                <td class="left_bt2">&nbsp;&nbsp;&nbsp;任务设置</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td height="289"><table width="100%" border="0" cellspacing="0" cellpadding="0">
			<form name="main" method="POST" action="AddAssignmentServlet">
            
             <tr>
                <td height="30" align="right" class="left_txt2">任务名：</td>
                <td>&nbsp;</td>
                <td height="30"><input type="text" name="asmt_name" size="30"  onblur = "checkNull()"/></td>
                <td height="30" class="left_txt">备份任务描述</td>
              </tr>
              
			 <tr>
                <td height="30" align="right" class="left_txt2">主机名：</td>
                <td>&nbsp;</td>
                <td height="30"><input type="text" name="ds_hostname" size="30" /></td>
                <td height="30" class="left_txt">计算机名</td>
              </tr>
			  
              <tr>
                <td height="30" align="right" class="left_txt2">源数据IP：</td>
                <td>&nbsp;</td>
                <td height="30">
                <table>
                       <tr height = "30">
                           <td> <input name="ip1" type="text" style="width : 40px" onBlur="checkDate(this,225);" onKeyDown="KeyDown(this)" onKeypress="Keypress(this)" size="3" value="" maxlength="3">.</td>
                           <td> <input name="ip2" type="text" style="width : 40px" onBlur="checkDate(this,255);" onKeyDown="KeyDown(this)" onKeypress="Keypress(this)" size="3" value="" maxlength="3">.</td>
                           <td> <input name="ip3" type="text" style="width : 40px" onBlur="checkDate(this,255);" onKeyDown="KeyDown(this)" onKeypress="Keypress(this)" size="3" value="" maxlength="3">.</td>
                           <td> <input name="ip4" type="text" style="width : 40px" onBlur="checkDate(this,255);" onKeyDown="KeyDown(this)" onKeypress="Keypress(this)" size="3" value="" maxlength="3"></td>
                      </tr>
                </table>
                </td>
                <td height="30" class="left_txt">元数据所在电脑的IP</td>
              </tr>
			  
              <tr>
                <td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">FTP端口：</td>
                <td bgcolor="#f2f2f2">&nbsp;</td>
                <td height="30" bgcolor="#f2f2f2"><input name="ds_port" type="text" size="6" maxlength="6" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td>
                <td height="30" bgcolor="#f2f2f2" class="left_txt">TCP协议通信提供服务的端口</td>
              </tr>
              
              <tr>
                <td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">FTP用户名：</td>
                <td bgcolor="#f2f2f2">&nbsp;</td>
                <td height="30" bgcolor="#f2f2f2"><input type="text" name="asmt_ftpname" size="30" /></td>
                <td height="30" bgcolor="#f2f2f2" class="left_txt">FTP服务器登入用户名</td>
              </tr>
              
              <tr>
                <td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">FTP密码：</td>
                <td bgcolor="#f2f2f2">&nbsp;</td>
                <td height="30" bgcolor="#f2f2f2"><input type="password" name="asmt_ftppwd" size="30" /></td>
                <td height="30" bgcolor="#f2f2f2" class="left_txt">FTP服务器登入密码</td>
              </tr>
           
              <tr>
                <td height="30" align="right" bgcolor="#f2f2f2" class="left_txt2">源数据路径：</td>
                <td bgcolor="#f2f2f2">&nbsp;</td>
                <td height="30" bgcolor="#f2f2f2"><div align="left">
                <input type="text" name="asmt_path" />
        </div></td>
                <td height="30" bgcolor="#f2f2f2" class="left_txt">要备份数据的位置</td>
              </tr>
			  <tr>
                 <td height="30" align="right" bgcolor="#F2F2F2" class="left_txt2">备份频率：</td>
                 <td bgcolor="#F2F2F2">&nbsp;</td>
                 <td height="30" bgcolor="#F2F2F2">每间隔
				 <input name="asmt_frequency" type="text" value="1" size="3" maxlength="3" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"/>
                 <select name = "asmt_frequencyMain" onChange="javaScript:changemaintype(document.main.asmt_frequencyMain.options[document.main.asmt_frequencyMain.selectedIndex].value);">
                       <option value = "">--请选择--</option>
                       <option value = "1">&nbsp;&nbsp;&nbsp;&nbsp;天</option>
                       <option value = "2">&nbsp;&nbsp;&nbsp;&nbsp;周</option>
                       <option value = "3">&nbsp;&nbsp;&nbsp;&nbsp;月</option>
                 </select>
                 </td>
                 <td height="30" bgcolor="#F2F2F2" class="left_txt">设置备份频率</td>
              </tr>
              
              <tr>
                 <td height="30" align="right" bgcolor="#F2F2F2" class="left_txt2">具体日期：</td>
                 <td bgcolor="#F2F2F2">&nbsp;</td>
                 <td height="30" bgcolor="#F2F2F2">
                 <select name = "asmt_frequencyDetail">
                       <option value = "">具体日期</option>
                 </select>
                 </td>
                 <td height="30" bgcolor="#F2F2F2" class="left_txt">具体时间点</td>
              </tr>
              
              
              <tr>
														<td height="30" align="right" bgcolor="#F7F8F9"
															class="left_txt2">
															备份时间：
														</td>
														<td bgcolor="#F7F8F9">&nbsp;
															
														</td>
														<td height="30" bgcolor="#F7F8F9">
															<label>
																<input name="hour" type="text" size="2"    onBlur="checkDate(this,23);" onKeypress="KeypressTime(this)" value="" maxlength="2"/>
															</label>
															时
															<label>
															  <input name="minute" type="text" size="2"    onBlur="checkDate(this,59);"  onKeypress="KeypressTime(this)" value="" maxlength="2"/>
															</label>
															分
					  <td height="30" bgcolor="#F7F8F9" class="left_txt">
																设置备份时间
															</td>
													</tr>
			              
			  

			  
              
            </table></td>
          </tr>
        </table>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            
            <tr>
              <td width="30%" height="10" align="right"><input type="submit" value="完成" name="B1" onclick = "checkIP()"/></td>
              <td width="6%" height="10" align="right">&nbsp;</td>
              <td width="44%" height="10"><input type="reset" value="取消" name="B12" /></td>
            </tr>
            
          </table></td>
      </tr>
    </table></td>
    <td background="Jsp/images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="Jsp/images/mail_leftbg.gif"><img src="Jsp/images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="Jsp/images/buttom_bgs.gif"><img src="Jsp/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="Jsp/images/mail_rightbg.gif"><img src="Jsp/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>
  </body>
</html>
